package cn.tedu.store.product.webapi.schedule;

import cn.tedu.store.product.service.IBrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 缓存处理计划任务类
 *
 * @author RelentlessFlow
 * @version 0.0.1
 */
@Slf4j
@Component
@EnableScheduling
public class RedisCacheSchedule {
    @Autowired
    IBrandService brandService;

    public RedisCacheSchedule() {
        log.debug("创建缓存计划任务类对象: RedisCacheSchedule");
    }

    @Scheduled(fixedRate = 5 * 60 * 1000)
    public void cacheRebuild() {
        brandService.rebuildCache();
    }
}
